﻿using ASmile.Extern.Lib.Rsp;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ASmile.Extern.Lib.Test
{
    public class TestResponse : HttpResponseDefault
    {
        public override string Type => "t001";

        protected override ApiResult GetResponseObject(Dictionary<string, string> jsonObj)
        {
            ApiResult result = new ApiResult();

            if (!jsonObj.ContainsKey("type"))
            {
                result.code = 101;
                result.msg = $"字典中不包含 type ";
                return result;
            }

            var type = jsonObj["type"];
            
            if (type != "1")
            {
                result.code = 102;
                result.msg = "错误的类型";
            }
            else
            {
                result.code = 0;
                result.msg = "OK";
                result.ExtendData = new DictExtend();
                result.ExtendData.SetValue("身份证号", "130133");
                result.ExtendData.SetValue("卡号", "123456");
            }
            return result;
        }
    }
}